#!/usr/bin/env python

from naoqi import ALProxy

IP = "127.0.0.1"
PORT = 9559


def calm_down():
	print "\tCALM DOWN!"
	names = list()
	times = list()
	keys = list()

	names.append("LShoulderPitch")
	times.append([ 4.66667, 5.86667])
	keys.append([ [ 1.04371, [ 2, -1.55556, 0.00000], [ 2, 0.40000, 0.00000]], [ 1.55334, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LShoulderRoll")
	times.append([ 0.06667, 1.80000, 3.33333, 4.66667, 5.86667, 7.40000, 8.13333, 9.13333])
	keys.append([ [ 0.10472, [ 2, -0.02222, 0.00000], [ 2, 0.57778, 0.00000]], [ 0.17453, [ 2, -0.57778, 0.00000], [ 2, 0.51111, 0.00000]], [ 0.01745, [ 2, -0.51111, 0.00000], [ 2, 0.44444, 0.00000]], [ 0.22689, [ 2, -0.44444, 0.00000], [ 2, 0.40000, 0.00000]], [ 0.20944, [ 2, -0.40000, 0.00000], [ 2, 0.51111, 0.00000]], [ 0.27925, [ 2, -0.51111, 0.00000], [ 2, 0.24444, 0.00000]], [ 0.26180, [ 2, -0.24444, 0.00000], [ 2, 0.33333, 0.00000]], [ 0.31416, [ 2, -0.33333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LElbowYaw")
	times.append([ 0.06667, 1.80000, 4.66667, 5.86667, 7.40000])
	keys.append([ [ 0.00000, [ 2, -0.02222, 0.00000], [ 2, 0.57778, 0.00000]], [ -0.32977, [ 2, -0.57778, 0.00000], [ 2, 0.95556, 0.00000]], [ -1.08210, [ 2, -0.95556, 0.23419], [ 2, 0.40000, -0.09803]], [ -1.32645, [ 2, -0.40000, 0.00000], [ 2, 0.51111, 0.00000]], [ -1.35438, [ 2, -0.51111, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LElbowRoll")
	times.append([ 0.06667, 1.80000, 4.66667, 5.86667, 7.40000, 8.13333, 9.13333, 11.06667])
	keys.append([ [ -0.00870, [ 2, -0.02222, 0.00000], [ 2, 0.57778, 0.00000]], [ -0.08727, [ 2, -0.57778, 0.00000], [ 2, 0.95556, 0.00000]], [ -1.19381, [ 2, -0.95556, 0.34039], [ 2, 0.40000, -0.14249]], [ -1.53589, [ 2, -0.40000, 0.00000], [ 2, 0.51111, 0.00000]], [ -1.04720, [ 2, -0.51111, 0.00000], [ 2, 0.24444, 0.00000]], [ -1.39626, [ 2, -0.24444, 0.02560], [ 2, 0.33333, -0.03491]], [ -1.43117, [ 2, -0.33333, 0.00000], [ 2, 0.64444, 0.00000]], [ -1.04720, [ 2, -0.64444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LWristYaw")
	times.append([ 0.06667, 4.66667, 5.86667])
	keys.append([ [ -0.55851, [ 2, -0.02222, 0.00000], [ 2, 1.53333, 0.00000]], [ 1.14668, [ 2, -1.53333, -0.28769], [ 2, 0.40000, 0.07505]], [ 1.22173, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LHand")
	times.append([ 4.66667, 5.86667])
	keys.append([ [ 0.90757, [ 2, -1.55556, 0.00000], [ 2, 0.40000, 0.00000]], [ 0.71908, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RShoulderPitch")
	times.append([ 4.66667, 5.86667])
	keys.append([ [ 1.04371, [ 2, -1.55556, 0.00000], [ 2, 0.40000, 0.00000]], [ 1.55334, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RShoulderRoll")
	times.append([ 0.06667, 1.80000, 3.33333, 4.66667, 5.86667, 7.40000, 8.13333, 9.13333])
	keys.append([ [ -0.10472, [ 2, -0.02222, 0.00000], [ 2, 0.57778, 0.00000]], [ -0.17453, [ 2, -0.57778, 0.00000], [ 2, 0.51111, 0.00000]], [ -0.01745, [ 2, -0.51111, 0.00000], [ 2, 0.44444, 0.00000]], [ -0.22689, [ 2, -0.44444, 0.04593], [ 2, 0.40000, -0.04134]], [ -0.27925, [ 2, -0.40000, 0.00000], [ 2, 0.51111, 0.00000]], [ -0.27925, [ 2, -0.51111, 0.00000], [ 2, 0.24444, 0.00000]], [ -0.26180, [ 2, -0.24444, 0.00000], [ 2, 0.33333, 0.00000]], [ -0.31416, [ 2, -0.33333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RElbowYaw")
	times.append([ 0.06667, 1.80000, 4.66667, 5.86667, 7.40000])
	keys.append([ [ 0.00000, [ 2, -0.02222, 0.00000], [ 2, 0.57778, 0.00000]], [ 0.32977, [ 2, -0.57778, 0.00000], [ 2, 0.95556, 0.00000]], [ 1.25664, [ 2, -0.95556, -0.16678], [ 2, 0.40000, 0.06981]], [ 1.32645, [ 2, -0.40000, 0.00000], [ 2, 0.51111, 0.00000]], [ 1.35438, [ 2, -0.51111, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RElbowRoll")
	times.append([ 0.06667, 1.80000, 4.66667, 5.86667, 7.40000, 8.13333, 9.13333, 11.06667])
	keys.append([ [ 0.00870, [ 2, -0.02222, 0.00000], [ 2, 0.57778, 0.00000]], [ 0.08727, [ 2, -0.57778, 0.00000], [ 2, 0.95556, 0.00000]], [ 1.19381, [ 2, -0.95556, -0.34039], [ 2, 0.40000, 0.14249]], [ 1.53589, [ 2, -0.40000, 0.00000], [ 2, 0.51111, 0.00000]], [ 1.04720, [ 2, -0.51111, 0.00000], [ 2, 0.24444, 0.00000]], [ 1.39626, [ 2, -0.24444, -0.02560], [ 2, 0.33333, 0.03491]], [ 1.43117, [ 2, -0.33333, 0.00000], [ 2, 0.64444, 0.00000]], [ 1.04720, [ 2, -0.64444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RWristYaw")
	times.append([ 0.06667, 4.66667, 5.86667])
	keys.append([ [ 0.55851, [ 2, -0.02222, 0.00000], [ 2, 1.53333, 0.00000]], [ -1.14668, [ 2, -1.53333, 0.43488], [ 2, 0.40000, -0.11345]], [ -1.12748, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RHand")
	times.append([ 4.66667, 5.86667])
	keys.append([ [ 0.90757, [ 2, -1.55556, 0.00000], [ 2, 0.40000, 0.00000]], [ 0.71908, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	try:
		motion = ALProxy("ALMotion", IP, PORT)
		moveId = motion.post.angleInterpolationBezier(names, times, keys);
		motion.wait('angleInterpolationBezier', 0)
	except BaseException, err:
		print err


def pickup(speed):
	print "\tpickup(" + str(speed) + ")"
	names = list()
	times = list()
	keys = list()

	names.append("RShoulderPitch")
	times.append([ 1.00000, 2.80000, 4.46667, 7.06667])
	keys.append([ [ 0.40143, [ 2, -0.33333, 0.00000], [ 2, 0.60000, 0.00000]], [ 1.39626, [ 2, -0.60000, 0.00000], [ 2, 0.55556, 0.00000]], [ -0.40143, [ 2, -0.55556, 0.00000], [ 2, 0.86667, 0.00000]], [ 1.01229, [ 2, -0.86667, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RShoulderRoll")
	times.append([ 1.00000, 2.80000, 4.46667])
	keys.append([ [ -0.40143, [ 2, -0.33333, 0.00000], [ 2, 0.60000, 0.00000]], [ -0.73304, [ 2, -0.60000, 0.00000], [ 2, 0.55556, 0.00000]], [ -0.73304, [ 2, -0.55556, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RElbowYaw")
	times.append([ 1.00000, 2.80000])
	keys.append([ [ 0.61087, [ 2, -0.33333, 0.00000], [ 2, 0.60000, 0.00000]], [ 1.64061, [ 2, -0.60000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RElbowRoll")
	times.append([ 1.00000, 2.80000, 4.46667])
	keys.append([ [ 0.00873, [ 2, -0.33333, 0.00000], [ 2, 0.60000, 0.00000]], [ 0.87266, [ 2, -0.60000, 0.00000], [ 2, 0.55556, 0.00000]], [ 0.87266, [ 2, -0.55556, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RWristYaw")
	times.append([ 1.00000, 2.80000, 7.06667])
	keys.append([ [ -0.13963, [ 2, -0.33333, 0.00000], [ 2, 0.60000, 0.00000]], [ 1.18682, [ 2, -0.60000, 0.00000], [ 2, 1.42222, 0.00000]], [ -0.26180, [ 2, -1.42222, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RHand")
	times.append([ 1.00000, 2.80000, 4.46667, 5.93333, 7.06667])
	keys.append([ [ 0.99484, [ 2, -0.33333, 0.00000], [ 2, 0.60000, 0.00000]], [ 0.00000, [ 2, -0.60000, 0.00000], [ 2, 0.55556, 0.00000]], [ 0.17453, [ 2, -0.55556, -0.04951], [ 2, 0.48889, 0.04357]], [ 0.27925, [ 2, -0.48889, 0.00000], [ 2, 0.37778, 0.00000]], [ 0.80285, [ 2, -0.37778, 0.00000], [ 2, 0.00000, 0.00000]]])

	newtimes = list()
	for tlist in times:
		newtlist = []
		for t in tlist:
			newtlist.append(t * speed)
		newtimes.append(newtlist)
	
	try:
		motion = ALProxy("ALMotion", IP, PORT)
		moveId = motion.post.angleInterpolationBezier(names, newtimes, keys);
		motion.wait('angleInterpolationBezier', 0)
	except BaseException, err:
		print err


def applause():
	print "\tAPPLAUSE!!!!"
	names = list()
	times = list()
	keys = list()

	names.append("LShoulderPitch")
	times.append([ 2.33333, 3.73333, 4.60000, 6.06667, 8.66667, 12.66667])
	keys.append([ [ 0.28623, [ 2, -0.77778, 0.00000], [ 2, 0.46667, 0.00000]], [ 0.22689, [ 2, -0.46667, 0.03198], [ 2, 0.28889, -0.01980]], [ 0.13090, [ 2, -0.28889, 0.00000], [ 2, 0.48889, 0.00000]], [ 0.13090, [ 2, -0.48889, 0.00000], [ 2, 0.86667, 0.00000]], [ 0.13090, [ 2, -0.86667, 0.00000], [ 2, 1.33333, 0.00000]], [ 0.13090, [ 2, -1.33333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LShoulderRoll")
	times.append([ 2.33333, 3.73333, 4.60000, 6.06667, 8.66667, 12.66667])
	keys.append([ [ 0.54105, [ 2, -0.77778, 0.00000], [ 2, 0.46667, 0.00000]], [ 0.35605, [ 2, -0.46667, 0.10960], [ 2, 0.28889, -0.06785]], [ 0.00873, [ 2, -0.28889, 0.00000], [ 2, 0.48889, 0.00000]], [ 0.00873, [ 2, -0.48889, 0.00000], [ 2, 0.86667, 0.00000]], [ 0.00873, [ 2, -0.86667, 0.00000], [ 2, 1.33333, 0.00000]], [ 0.00873, [ 2, -1.33333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LElbowYaw")
	times.append([ 2.33333, 3.73333, 4.60000])
	keys.append([ [ -0.62308, [ 2, -0.77778, 0.00000], [ 2, 0.46667, 0.00000]], [ -1.25664, [ 2, -0.46667, 0.00000], [ 2, 0.28889, 0.00000]], [ -0.40143, [ 2, -0.28889, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LElbowRoll")
	times.append([ 2.33333, 3.73333, 4.60000, 6.06667, 7.00000, 8.66667, 10.66667, 12.66667, 14.66667])
	keys.append([ [ -0.52360, [ 2, -0.77778, 0.00000], [ 2, 0.46667, 0.00000]], [ -0.43633, [ 2, -0.46667, 0.00000], [ 2, 0.28889, 0.00000]], [ -0.58119, [ 2, -0.28889, 0.00000], [ 2, 0.48889, 0.00000]], [ -0.01745, [ 2, -0.48889, 0.00000], [ 2, 0.31111, 0.00000]], [ -0.70686, [ 2, -0.31111, 0.00000], [ 2, 0.55556, 0.00000]], [ -0.01745, [ 2, -0.55556, 0.00000], [ 2, 0.66667, 0.00000]], [ -0.70686, [ 2, -0.66667, 0.00000], [ 2, 0.66667, 0.00000]], [ -0.01745, [ 2, -0.66667, 0.00000], [ 2, 0.66667, 0.00000]], [ -0.70686, [ 2, -0.66667, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LWristYaw")
	times.append([ 4.60000])
	keys.append([ [ -1.03498, [ 2, -1.53333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LHand")
	times.append([ 4.60000])
	keys.append([ [ 0.69988, [ 2, -1.53333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RShoulderPitch")
	times.append([ 2.33333, 3.73333, 4.60000, 6.06667, 8.66667, 12.66667])
	keys.append([ [ 0.28623, [ 2, -0.77778, 0.00000], [ 2, 0.46667, 0.00000]], [ 0.22689, [ 2, -0.46667, 0.03198], [ 2, 0.28889, -0.01980]], [ 0.13090, [ 2, -0.28889, 0.00000], [ 2, 0.48889, 0.00000]], [ 0.13090, [ 2, -0.48889, 0.00000], [ 2, 0.86667, 0.00000]], [ 0.13090, [ 2, -0.86667, 0.00000], [ 2, 1.33333, 0.00000]], [ 0.13090, [ 2, -1.33333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RShoulderRoll")
	times.append([ 2.33333, 3.73333, 4.60000, 6.06667, 8.66667, 12.66667])
	keys.append([ [ -0.54105, [ 2, -0.77778, 0.00000], [ 2, 0.46667, 0.00000]], [ -0.35605, [ 2, -0.46667, -0.10960], [ 2, 0.28889, 0.06785]], [ -0.00873, [ 2, -0.28889, 0.00000], [ 2, 0.48889, 0.00000]], [ -0.00873, [ 2, -0.48889, 0.00000], [ 2, 0.86667, 0.00000]], [ -0.00873, [ 2, -0.86667, 0.00000], [ 2, 1.33333, 0.00000]], [ -0.00873, [ 2, -1.33333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RElbowYaw")
	times.append([ 2.33333, 3.73333, 4.60000])
	keys.append([ [ 0.62308, [ 2, -0.77778, 0.00000], [ 2, 0.46667, 0.00000]], [ 1.25664, [ 2, -0.46667, 0.00000], [ 2, 0.28889, 0.00000]], [ 0.40143, [ 2, -0.28889, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RElbowRoll")
	times.append([ 2.33333, 3.73333, 4.60000, 6.06667, 7.00000, 8.66667, 10.66667, 12.66667, 14.66667])
	keys.append([ [ 0.52360, [ 2, -0.77778, 0.00000], [ 2, 0.46667, 0.00000]], [ 0.43633, [ 2, -0.46667, 0.00000], [ 2, 0.28889, 0.00000]], [ 0.58119, [ 2, -0.28889, 0.00000], [ 2, 0.48889, 0.00000]], [ 0.01745, [ 2, -0.48889, 0.00000], [ 2, 0.31111, 0.00000]], [ 0.70686, [ 2, -0.31111, 0.00000], [ 2, 0.55556, 0.00000]], [ 0.01745, [ 2, -0.55556, 0.00000], [ 2, 0.66667, 0.00000]], [ 0.70686, [ 2, -0.66667, 0.00000], [ 2, 0.66667, 0.00000]], [ 0.01745, [ 2, -0.66667, 0.00000], [ 2, 0.66667, 0.00000]], [ 0.70686, [ 2, -0.66667, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RWristYaw")
	times.append([ 4.60000])
	keys.append([ [ 1.03498, [ 2, -1.53333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RHand")
	times.append([ 4.60000])
	keys.append([ [ 0.69988, [ 2, -1.53333, 0.00000], [ 2, 0.00000, 0.00000]]])

	newtimes = list()
	for tlist in times:
		newtlist = []
		for t in tlist:
			newtlist.append(t / 3)
		newtimes.append(newtlist)

	try:
		motion = ALProxy("ALMotion", IP, PORT)
		moveId = motion.post.angleInterpolationBezier(names, newtimes, keys);
		motion.wait('angleInterpolationBezier', 0)
	except BaseException, err:
		print err


def back_up():
	print "\tback up!!"
	names = list()
	times = list()
	keys = list()

	names.append("HeadYaw")
	times.append([ 8.20000])
	keys.append([ [ 0.00000, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("HeadPitch")
	times.append([ 8.20000])
	keys.append([ [ 0.00000, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LShoulderPitch")
	times.append([ 8.20000])
	keys.append([ [ 1.83260, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LShoulderRoll")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ 0.20944, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ 0.01745, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LElbowYaw")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ -1.48353, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ 0.17279, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LElbowRoll")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ -0.52360, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ -0.44506, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LWristYaw")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ 0.00000, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ 0.90757, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LHand")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ 0.00000, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ 0.35605, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RShoulderPitch")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ 1.83260, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ 1.85005, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RShoulderRoll")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ -0.20944, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ -0.01745, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RElbowYaw")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ 1.48353, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ -0.17279, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RElbowRoll")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ 0.52360, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ 0.44506, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RWristYaw")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ 0.00000, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ -0.90757, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RHand")
	times.append([ 8.20000, 9.53333])
	keys.append([ [ 0.00000, [ 2, -2.73333, 0.00000], [ 2, 0.44444, 0.00000]], [ 0.35605, [ 2, -0.44444, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LHipYawPitch")
	times.append([ 8.20000])
	keys.append([ [ 0.00000, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LHipRoll")
	times.append([ 8.20000])
	keys.append([ [ -0.02196, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LHipPitch")
	times.append([ 8.20000])
	keys.append([ [ -0.32084, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LKneePitch")
	times.append([ 8.20000])
	keys.append([ [ 0.91681, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LAnklePitch")
	times.append([ 8.20000])
	keys.append([ [ -0.59598, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LAnkleRoll")
	times.append([ 8.20000])
	keys.append([ [ 0.02196, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RHipRoll")
	times.append([ 8.20000])
	keys.append([ [ 0.00584, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RHipPitch")
	times.append([ 8.20000])
	keys.append([ [ -0.45126, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RKneePitch")
	times.append([ 8.20000])
	keys.append([ [ 0.95668, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RAnklePitch")
	times.append([ 8.20000])
	keys.append([ [ -0.50542, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("RAnkleRoll")
	times.append([ 8.20000])
	keys.append([ [ -0.00584, [ 2, -2.73333, 0.00000], [ 2, 0.00000, 0.00000]]])

	try:
		motion = ALProxy("ALMotion", IP, PORT)
		moveId = motion.post.angleInterpolationBezier(names, times, keys);
		motion.wait('angleInterpolationBezier', 0)
	except BaseException, err:
		print err

def headApproval():
	names = list()
	times = list()
	keys = list()

	names.append("HeadYaw")
	times.append([ 0.06667, 1.60000, 2.86667])
	keys.append([ [ 0.00000, [ 2, -0.02222, 0.00000], [ 2, 0.51111, 0.00000]], [ 0.00000, [ 2, -0.51111, 0.00000], [ 2, 0.42222, 0.00000]], [ 0.00000, [ 2, -0.42222, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("HeadPitch")
	times.append([ 0.06667, 1.60000, 1.66667, 2.86667])
	keys.append([ [ -0.40143, [ 2, -0.02222, 0.00000], [ 2, 0.51111, 0.00000]], [ 0.34527, [ 2, -0.51111, 0.00000], [ 2, 0.02222, 0.00000]], [ 0.34907, [ 2, -0.02222, 0.00000], [ 2, 0.40000, 0.00000]], [ -0.36652, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	try:
		motion = ALProxy("ALMotion", IP, PORT)
		moveId = motion.post.angleInterpolationBezier(names, times, keys);
		motion.wait('angleInterpolationBezier', 0)
	except BaseException, err:
		print err

		
		
def davai():
	names = list()
	times = list()
	keys = list()

	names.append("LShoulderPitch")
	times.append([ 0.06667, 7.33333, 8.66667, 9.73333, 10.60000, 11.46667, 12.80000, 14.00000])
	keys.append([ [ 0.00000, [ 2, -0.02222, 0.00000], [ 2, 2.42222, 0.00000]], [ -0.29671, [ 2, -2.42222, 0.00000], [ 2, 0.44444, 0.00000]], [ 1.25140, [ 2, -0.44444, 0.00000], [ 2, 0.35556, 0.00000]], [ 1.12050, [ 2, -0.35556, 0.13090], [ 2, 0.28889, -0.10636]], [ 0.26005, [ 2, -0.28889, 0.17802], [ 2, 0.28889, -0.17802]], [ 0.05236, [ 2, -0.28889, 0.00000], [ 2, 0.44444, 0.00000]], [ 1.32645, [ 2, -0.44444, 0.00000], [ 2, 0.40000, 0.00000]], [ 1.06465, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LShoulderRoll")
	times.append([ 0.06667, 7.33333, 8.66667, 9.73333, 10.60000, 11.46667, 12.80000, 14.00000])
	keys.append([ [ 0.00870, [ 2, -0.02222, 0.00000], [ 2, 2.42222, 0.00000]], [ 0.73653, [ 2, -2.42222, -0.08561], [ 2, 0.44444, 0.01571]], [ 0.75224, [ 2, -0.44444, 0.00000], [ 2, 0.35556, 0.00000]], [ 0.22864, [ 2, -0.35556, 0.13674], [ 2, 0.28889, -0.11110]], [ 0.00873, [ 2, -0.28889, 0.00000], [ 2, 0.28889, 0.00000]], [ 0.85521, [ 2, -0.28889, 0.00000], [ 2, 0.44444, 0.00000]], [ 0.36477, [ 2, -0.44444, 0.11574], [ 2, 0.40000, -0.10417]], [ 0.19548, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LElbowYaw")
	times.append([ 0.06667, 7.33333, 8.66667, 9.73333, 10.60000, 11.46667, 12.80000, 14.00000])
	keys.append([ [ -1.55334, [ 2, -0.02222, 0.00000], [ 2, 2.42222, 0.00000]], [ -1.11701, [ 2, -2.42222, -0.20745], [ 2, 0.44444, 0.03806]], [ -0.81681, [ 2, -0.44444, 0.00000], [ 2, 0.35556, 0.00000]], [ -1.22522, [ 2, -0.35556, 0.00000], [ 2, 0.28889, 0.00000]], [ -1.22522, [ 2, -0.28889, 0.00000], [ 2, 0.28889, 0.00000]], [ -1.20428, [ 2, -0.28889, -0.02094], [ 2, 0.44444, 0.03222]], [ -0.99484, [ 2, -0.44444, 0.00000], [ 2, 0.40000, 0.00000]], [ -1.09607, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LElbowRoll")
	times.append([ 0.06667, 7.33333, 8.66667, 9.73333, 10.60000, 11.46667, 12.80000, 14.00000])
	keys.append([ [ -0.00870, [ 2, -0.02222, 0.00000], [ 2, 2.42222, 0.00000]], [ -1.55334, [ 2, -2.42222, 0.00000], [ 2, 0.44444, 0.00000]], [ -0.92502, [ 2, -0.44444, -0.14932], [ 2, 0.35556, 0.11946]], [ -0.74700, [ 2, -0.35556, 0.00000], [ 2, 0.28889, 0.00000]], [ -0.74700, [ 2, -0.28889, 0.00000], [ 2, 0.28889, 0.00000]], [ -0.83427, [ 2, -0.28889, 0.00000], [ 2, 0.44444, 0.00000]], [ -0.43633, [ 2, -0.44444, 0.00000], [ 2, 0.40000, 0.00000]], [ -0.57596, [ 2, -0.40000, 0.00000], [ 2, 0.00000, 0.00000]]])

	names.append("LWristYaw")
	times.append([ 12.80000])
	keys.append([ [ 0.11345, [ 2, -4.26667, 0.00000], [ 2, 0.00000, 0.00000]]])

	newtimes = list()
	for tlist in times:
		newtlist = []
		for t in tlist:
			newtlist.append(t / 3)
		newtimes.append(newtlist)

	try:
		motion = ALProxy("ALMotion", IP, PORT)
		moveId = motion.post.angleInterpolationBezier(names, newtimes, keys);
		motion.wait('angleInterpolationBezier', 0)
	except BaseException, err:
		print err

